- if @search_mode == "genes" 
  - entity = GenePresenter.new(entity)
- else
  - entity = DrugPresenter.new(entity)

%div(class="item-title")
  %div(class="item-name")
    %h3(class="item-source")
      %span
        = "Search Term: " + "\"" + term + "\""
      %span{class: "glyphicon glyphicon-play", "aria-hidden" => "true", style: "margin-left: 10px; margin-right: -8px"}
      &nbsp
      - if @search_mode == "genes"
        %a{href: "/genes/#{entity.name}#_interactions"}
          = entity.name
      - else
        %a{href: "/drugs/#{entity.name}#_interactions"}
          = entity.name

%div(class="item-content")
  %div(class="cell category")
    %div{class: "item-panel"}
      %h4{style: "display: inline-block;"}
      - interactions = filtered_interactions.sort_by { |i| -scores[i.id] }.map{|i| InteractionPresenter.new(i)}
      - if interactions.count > 0
        %table{class: "search_panel table table-condensed table-striped", style: "width: 100%; margin-top: -20px;"}
          %tr
            %th
              - if @search_mode == "genes"
                Drug
              - else
                Gene
            %th
              Interaction Type
            %th
              Interaction Directionality
            %th
              Sources
            %th
              PMIDs
            %th
              Score
          %tbody
          - interactions.each do |interaction|
            %tr{onclick: "location.href='/interactions/#{interaction.id}';"}
              %td
                - if @search_mode == "genes"
                  %a{href: "/drugs/#{interaction.drug.name}"}
                    = interaction.drug.name
                - else
                  %a{href: "/genes/#{interaction.gene.name}"}
                    = interaction.gene.name
              %td
                = interaction.na_or_types.join(", ")
              %td
                = interaction.directionality.join(", ")
              %td
                = interaction.sources.map{|source| TrustLevelPresenter.source_link_green(@view_context, source)}.join(' ').html_safe
              %td
                - if (pub_count = interaction.publications.size) > 0
                  = interaction.publications.map{|pub| pubmed_link_blue(pub.pmid)}.join(" ").html_safe
                - else
                  %i
                    None found
              %td
                = scores[interaction.id]
        %button{class: "show-all", style: "margin-top: 5px"}
          Show All
        %button{class: "show-more", style: "margin-top: 5px"}
          Show More
        %button{class: "show-less", style: "margin-top: 5px"}
          Show Less
        %span{style: "display: inline-block; margin-top: 5px; margin-left: 5px"}
          Showing
          %span#nrows
            = [10, interactions.length].min
          %span
            = "out of #{interactions.length} Interactions"
      - else
        No interactions found.

:css
  tr:hover td{
    background-color:rgba(220, 220, 220, 1);
    cursor: pointer;
  }
  td .label {
    display: inline-block;
    margin-bottom: 3px;
  }
